shuju()

function shuju() {
	var oarr = [];
	var obj = {};
	var oarr_radio = [];
	var obj_radio = {};
	var oarr_hot = [];
	var obj_hot = {};
	var xhr = new XMLHttpRequest();
	var domian = "https://www.easy-mock.com/mock/5aa77cc32b0894377fc76657";
	//推荐页数据
	xhr.open("GET", domian + "/qqmusic");
	xhr.send();
	xhr.addEventListener("readystatechange", function() {
		var get_swi = document.querySelector(".swiper-wrapper");
		var get_radio = document.querySelector("#radio_wrapper");
		var get_hot = document.querySelector("#songlist_wrapper");
		if(xhr.status == 200 && xhr.readyState == 4) {
			//					console.log(xhr.response)
			obj = JSON.parse(xhr.response);
			oarr = obj.slider;
			//电台
			obj_radio = JSON.parse(xhr.response);
			oarr_radio = obj_radio.radioList;
			//热门歌单
			obj_hot = JSON.parse(xhr.response);
			oarr_hot = obj_hot.songList;
//			console.log(oarr_hot);
		}
		var temp = '';
		oarr.forEach(function(el, index) {
			temp += `<div class="swiper-slide"><img src='${oarr[index].picUrl}' /></div>`;
		})
		get_swi.innerHTML += temp;
		var temp_radio = '';
		oarr_radio.forEach(function(el, index) {
			temp_radio += `<li class="js_play_radio" data-id='${oarr_radio[index].radioid}'>
							<a class="list_main" href="javascript:;">
								<div class="list_media">

									<img class="list_pic" src='${oarr_radio[index].picUrl}' alt="">
									<span class="iconfont icon_bofang"></span>
								</div>
								<div class="list_info">
									<h3 class="list_tit tit_two_row">${oarr_radio[index].Ftitle}</h3>
								</div>
							</a>
						</li>`;
		})
		get_radio.innerHTML += temp_radio;
		var temp_hot = '';
		oarr_hot.forEach(function(el, index) {
			temp_hot += `<li data-tjname="recom_songlist">
							<a class="list_main js_gotaoge" href="javascript:;" data-href="//y.qq.com/w/taoge.html?ADTAG=myqq&amp;from=myqq&amp;channel=10007100&amp;id='${oarr_hot[index].id}'">
								<div class="list_media">

									<img data-url='${oarr_hot[index].picUrl}' src='${oarr_hot[index].picUrl}' />
									<span class="listen_count"><i class="iconfont icon_listen"></i>${num(el.accessnum)}万</span>
									<span class="iconfont icon_bofang js_play_songlist" data-id='${oarr_hot[index].id}'></span>
								</div>
								<div class="list_info">
									<h3 class="list_tit">${oarr_hot[index].songListDesc}</h3>
									<p class="list_text">${oarr_hot[index].songListAuthor}</p>
								</div>
							</a>
						</li>`;
		})
		get_hot.innerHTML += temp_hot;
	})
	function num(list){
		var nums = Math.round(parseFloat(list)/10000)
		return nums.toFixed(1)
	}
}